﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="NullStorageService.cs" company="XamlNinja">
//   2011 Richard Griffin and Ollie Riches
// </copyright>
// <summary>
//   The null storage service.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace WP7Contrib.Services.Storage
{
    using System.Linq.Expressions;

    /// <summary>
    /// The null storage service.
    /// </summary>
    public sealed class NullStorageService : IStorageService
    {
        /// <summary>
        /// Opens an instance of the transient storage, the contents will not survive an application restart - this implementation does nothing.
        /// </summary>
        /// <param name="name">
        /// The context for the storage, e.g. view model name
        /// </param>
        /// <returns>
        /// Returns an instance of the transient storage.
        /// </returns>
        public IStorage OpenTransient(string name)
        {
            return new NullStorage();
        }

        /// <summary>
        /// Opens an instance of the transient storage, the contents will not survive an application restart - this implementation does nothing.
        /// </summary>
        /// <param name="expression">
        /// An expression used to express the name of the context for the storage, e.g. '() =&gt; MyPropertyName'
        /// </param>
        /// <typeparam name="T">
        /// The type contained in the expression.
        /// </typeparam>
        /// <returns>
        /// Returns an instance of the transient storage.
        /// </returns>
        public IStorage OpenTransient<T>(Expression<System.Func<T>> expression)
        {
            return new NullStorage();
        }

        /// <summary>
        /// Opens an instance of the persistent storage, the contents will not survive an application restart - this implementation does nothing.
        /// </summary>
        /// <param name="name">
        /// The context for the storage, e.g. view model name
        /// </param>
        /// <returns>
        /// Returns an instance of the persistent storage.
        /// </returns>
        public IStorage OpenPersistent(string name)
        {
            return new NullStorage();
        }

        /// <summary>
        /// Opens an instance of the persistent storage, the contents will not survive an application restart - this implementation does nothing.
        /// </summary>
        /// <param name="expression">
        /// An expression used to express the name of the context for the storage, e.g. '() =&gt; MyPropertyName'
        /// </param>
        /// <typeparam name="T">
        /// The type contained in the expression.
        /// </typeparam>
        /// <returns>
        /// Returns an instance of the persistent storage.
        /// </returns>
        public IStorage OpenPersistent<T>(Expression<System.Func<T>> expression)
        {
            return new NullStorage();
        }
    }
}